<html>
<head>
	<script type="text/javascript" src="../../../dojo.js"></script>
	<script type="text/javascript">
	    var myModule1Value = {}, myModule2Value = {};
		define("myModule1", [], myModule1Value);
		define("myModule2", [], myModule2Value);
		require({
			aliases:[
				// yourModule --> myModule1
				["yourModule", "myModule1"],
	
				// yourOtherModule --> myModule1						
				[/yourOtherModule/, "myModule1"],
	
				// yourModule/*/special --> yourModule/common/special
				// this will result in a resubmission to finally resolve in the next one
				[/yourOtherModule\/([^\/]+)\/special/, "yourOtherModule/common/special"],
	
				// yourModule/common/special --> myModule2
				// notice the regex above also finds yourOtherModule/common/special; 
				// the extra parenthesized subexprs make this have priority
				[/(yourOtherModule\/(common))\/special/, "myModule2"]
			],
			paths:{myTopLevelModule:"./tests/_base/loader/myTopLevelModule"}							   
		});
			

		require(["myTopLevelModule", "doh", "myModule1", "myModule2", "yourModule", "yourOtherModule", "yourOtherModule/stuff/special"],
			function(myModule, doh, myModule1, myModule2, myModule1_1, myModule1_2, myModule2_1){
			doh.register("aliases", [
				function(t){
					t.is(myModule1Value, myModule1);
					t.is(myModule1Value, myModule1_1);
					t.is(myModule1Value, myModule1_2);
					t.is(myModule2Value, myModule2);
					t.is(myModule2Value, myModule2_1);
				}
			]);
			doh.register("top-level-module-via-paths", [
				function(t){
					t.is(myTopLevelModule.name, "myTopLevelModule");
					t.is(myTopLevelModule.myModule.name, "myTopLevelModule.myModule");
				}
			]);
			doh.runOnLoad();
		});
	</script>
</head>
<body>
</body>
</html>
